package com.zone.domain.strategy.model.valobj;

/**
 * @author: zongzi
 * @description: 抽奖规则模型枚举
 * @date: 2024/5/30
 */
public enum RaffleRuleModelEnum {
    RULE_BLACKLIST(RuleEnums.RuleModelEnum.RULE_BLACKLIST.getCode(), "【抽奖前】根据黑名单用户返回指定奖品", RaffleType.BEFORE.getType(), 1),
    RULE_WEIGHT(RuleEnums.RuleModelEnum.RULE_WEIGHT.getCode(), "【抽奖前】根据奖品权重进行抽奖", RaffleType.BEFORE.getType(), 2),
    RULE_LOCK(RuleEnums.RuleModelEnum.RULE_LOCK.getCode(), "【抽奖中】用户抽奖指定次数后解锁奖品", RaffleType.CENTER.getType(), 100),
    ;

    // 对应规则配置中的rule_model
    private final String code;
    // 描述
    private final String desc;
    // 抽奖生命周期：抽奖前、抽奖中、抽奖后
    private final String type;
    // 排序字段，在构建处理器链中使用，用于各个处理器在链表中的顺序
    private final Integer sort;

    RaffleRuleModelEnum(String code, String desc, String type, Integer sort) {
        this.code = code;
        this.desc = desc;
        this.type = type;
        this.sort = sort;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getType() {
        return type;
    }

    public Integer getSort() {
        return sort;
    }


    public enum RaffleType {
        BEFORE("before"),
        CENTER("center"),
        ;
        private final String type;

        RaffleType(String type) {
            this.type = type;
        }

        public String getType() {
            return type;
        }
    }
}
